The Null Device
Posts matching tags 'python 3000'
2006/8/29
The core developers of Python (a rather elegant open-source programming language, in which, incidentally, this website is written) have broken ground on Python 3000, the massive, compatibility-breaking overhaul they intend to give Python, fixing the mistakes, shortcomings and inelegancies in the current version. Here are the things that will change, and here are the things that won't.
It's heartening to see that lambda functions (once slated to be abolished) have been given a reprieve. Otherwise there would have been no concise way of passing anonymous functions as a data type, and instead of being able to do something like (to quote a rather silly example):
greeters = { 'english' : lambda name: "Hello, %s"%name, 'french' : lambda name: "Bonjour, %s"%name, 'australian' : lambda name: "G'day, %s"%name }one would have to take the long way around, doing something like:
def greet_english(name): return "Hello, %s"%name def greet_french(name): return "Bonjour, %s"%name def greet_australian(name): return "G'day, %s"%name greeters = { 'english': greet_english, ... }And I don't buy the argument that anonymous functions are bad form, and that each chunk of code should have a name that describes what it does. There are many instances where one wants to specify a tiny fragment of code which will fit into a larger mechanism like a small but crucial cog (be it in a function call, a data structure or wherever), without the bureaucratic overhead of giving it a name. Otherwise we may as well be programming in Java or COBOL or some Vogon-designed abomination of a language.